@extends('layout.index')
@section('title', '后台商品修改')
@section('content')
 <div class="mws-panel grid_8">
    
    <div class="mws-panel-body no-padding">
        <form action="/admin/goods/update" method='post' class="mws-form " enctype="multipart/form-data">
        @if (count($errors) >0)
            <div class='mws-form-message error'>
                修改失败!
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{$error}}</li>
                    @endforeach

                </ul>
            </div>

        @endif
            <div class="mws-panel grid_8">
                    <div class="mws-panel-header">
                        <span>商品修改</span>
                    </div>
                    <div class="mws-panel-body no-padding">
                        
                            <div class="mws-form-inline">
                                <div class="mws-form-row">
                                    <label class="mws-form-label">商品名</label>
                                    <div class="mws-form-item">
                                        <input type="text" class="smallinfo" name='proname' value = "{{$goodsinfo->proname}}">
                                    </div>
                                </div>
                              
                            
                                
                                <div class="mws-form-row">
                                    <label class="mws-form-label">商品状态</label>
                                    <div class="mws-form-item">

                                        <select class="smallinfo" name='state'>

                                            <option value ="0" 
                                            @if( $goodsinfo->state == 0 )
                                                selected
                                            @endi= 1 )
                                                            selected
                                                            @endif  >首发</option>
                                            <option value ="2" @if( $goodsinfo->state == 2 )
                                                            selected
                                                            @endif  >下架</option>
                                            <option value ="3" @if($goodsinfo->state == 3 )
                                                            selected
                                                            @endif  >缺货</option>
                                            <option value ="4" @if( $goodsinfo->state == 4 )
                                                            selected
                                                            @endif  >有货</option>
                                            
                                        </select>
                                    </div>
                                </div>
                               

                                
                                 <div class="mws-form-row">
                                    <label class="mws-form-label">商品专区</label>
                                    <div class="mws-form-item">
                                        <select class="smallinfo" name='zome'>
                                            <option value ="0 " @if( $goodsinfo->zome == 0 )
                                                               selected
                                                               @endif >小米手机</option>
                                            <option value =" 1" @if( $goodsinfo->zome == 1 )
                                                               selected
                                                               @endif>红米手机</option>
                                            <option value =" 2" @if( $goodsinfo->zome == 2 )
                                                               selected
                                                               @endif>小米平板</option>
                                            <option value =" 3" @if( $goodsinfo->zome == 3 )
                                                               selected
                                                               @endif>小米电视</option>
                                            <option value ="4 " @if( $goodsinfo->zome == 4 )
                                                               selected
                                                               @endif>硬件专区</option>
                                            <option value ="5 " @if( $goodsinfo->zome == 4 )
                                                               selected
                                                               @endif>配件专区</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="mws-form-row">
                                    <label class="mws-form-label">商品类别</label>
                                    <div class="mws-form-item">
                                        <select class="smallinfo" name="cateid" value = "{{$goodsinfo->cateid}}">
                                        @foreach($cates as $k=>$v) 
                                            <option value ="{{$v->id}}">{{$v->catename}}</option>
                                         @endforeach 
                                        </select>
                                    </div>
                                </div>

                                 <div class="mws-form-row">
                                     <label class="mws-form-label">原图片:</label>
                                         <div class="mws-form-item">
                                            <label class="mws-form-label">
                                                <img src="{{$goodsinfo->image}}" alt="" width='100px'>
                                            </label>
                                    </div>
                                </div>

                                <div class="mws-form-row">
                                        <label class="mws-form-label">商品图片:</label>
                                        
                                        <div class="mws-form-item">
                                            <div style="position: relative;" class="fileinput-holder">
                                            
                                                <input name= "image" type="file" style="position: absolute; top: 0px; right: 0px; margin: 0px; cursor: pointer; font-size: 999px; opacity: 0; z-index: 999;">
                                                
                                            </div>
                                        </div>
                                </div>
                            <div class="mws-form-row"> 
                            <label class="mws-form-label">商品描述:</label> 
                            <br> 
                            <br> 
                            <br> 
                           
                                <script  name ='des' id="editor" type="text/plain" style="width:950px;height:300px;">
                                {!!$goodsinfo->des!!}
                                </script>
                            </div>
                            <input type="hidden" name="id" value="{{$goodsinfo->id}}">
                             
                            {{csrf_field()}}
                            <div class="mws-button-row">
                                <input type="submit" class="btn btn-danger" value="Submit">
                                <input type="reset" class="btn " value="Reset">
                            </div>
                        </form>
                    </div>      
                </div>

                <script type="text/javascript">
                var ue = UE.getEditor('editor');
                </script>
@endsection



